﻿using System;
using System.IO;

namespace Silverlight.PreLoading
{
    public interface IPreLoadable
    {
        /// <summary>
        /// Begins preloading the content
        /// </summary>
        void PreLoad();

        /// <summary>
        /// Raised when a chunk of data is successfully downloaded
        /// </summary>
        event EventHandler<PreLoadingProgressEventArgs> OnPreLoadingProgress;

        /// <summary>
        /// Raised when this item has been entirely downloaded
        /// </summary>
        event EventHandler<PreLoadingItemCompleteEventArgs> OnPreLoaded;

        /// <summary>
        /// Raised when downloading this item failed
        /// </summary>
        event EventHandler OnPreLoadFailed;

        /// <summary>
        /// Gets the preloaded content as a Stream
        /// </summary>
        Stream Stream { get; }

        /// <summary>
        /// Gets the category assigned to this item when it was constructed
        /// </summary>
        string Category { get; }

        /// <summary>
        /// Gets the total progress of this download as a double between 0.0 and 1.0
        /// </summary>
        double Progress { get; }
    }
}